import java.util.Objects;
import java.util.Scanner;
public class homeWork {
    public static void main(String[] args) {
        for (int year = 1000; year <=2000 ; year++) {
            if ((year%4==0)&&(year%100!=0)||(year%400==0)){
                System.out.println(year);
            }
            
        }
    }
    public static void main9(String[] args) {
        int i=1;
        int j=2;
        for ( i = 1; i <=100 ; i++) {
            for ( j = 2; j <i ; j++) {
                if(i%j==0){
                    break;
                }
            }
            if(i==j){
                System.out.println(i);
            }
            
        }
    }
    public static void main8(String[] args) {
        Scanner in =new Scanner(System.in);
        int a=in.nextInt();
        int i=0;
        for (i=2;i<a;i++){
            if(a%i==0){
                System.out.println("不是素数");
                break;
            }
        }
        if(i==a){
            System.out.println("是素数");
        }
    }
    public static void main7(String[] args) {
//        根据输入的年龄, 来打印出当前年龄的人是少年(低于18), 青年(19-28), 中年(29-55), 老年(56以上)
        Scanner in =new Scanner(System.in);
        int a=in.nextInt();
        if(a<=18&&a>0)
        {
            System.out.println("少年");
        }
        else if(a>=19&&a<=28){
            System.out.println("青年");
        }
        else if(a>=29&&a<=55)
        {
            System.out.println("中年");
        }
        else {
            System.out.println("老年");

        }
    }
    public static void main6(String[] args) {
        for(int n=1;n<999;n++){
            int tmp=n;
            int count = 0;
            while(tmp!=0){
                count++;
                tmp = tmp/10;
            }
            tmp=n;
            int sum = 0;
            while(tmp!=0){
                sum += Math.pow(tmp%10,count);
                tmp = tmp/10;
            }
            if(sum==n){
                System.out.println(sum+"是水仙花数");
            }
        }
    }
    public static void main5(String[] args) {
        Scanner in =new Scanner(System.in);
        int a=in.nextInt();
        int b=in.nextInt();
        int c=0;
        if(a<b){
            int tmp =a;
            a=b;
            b=tmp;
        }
        while (a%b!=0){
            c=a%b;
            a=b;
            b=c;
        }
        System.out.println(b);
    }
    public static void main4(String[] args) {
        Scanner in =new Scanner(System.in);
        System.out.println("请输入数字");
        int num=in.nextInt();
        for (int i = 31; i >=0 ; i-=2) {
            System.out.print(((num>>i)&i)+" ");
        }
        System.out.print("\n");
        for (int i = 30; i >=0 ; i-=2) {
            System.out.print(((num>>i)&i)+" ");
        }
    }
    public static void main3(String[] args) {
        Scanner in =new Scanner(System.in);
        System.out.println("请输入数字");
        int num=in.nextInt();
        int count =0;
        for (int i = 0; i < 32; i++) {
            if( ((num>>i)&1)==1){
                count++;
            }
        }
        System.out.println(count);
    }
//    编写代码模拟三次密码输入的场景。 最多能输入三次密码，密码正确，提示“登录成功”,密码错误，
//    可以重新输 入，最多输入三次。三次均错，则提示退出程序
    public static void main2(String[] args) {

        int count =3;
        while (count>0) {
            System.out.println("请输入密码");
            Scanner in = new Scanner(System.in);
            String userPassword = in.nextLine();
            if (userPassword.equals("123456")) {
                System.out.println("密码正确");
                break;
            }
            else {
                count--;
                System.out.println("密码错误");
            }
        }
    }
    public static void main1(String[] args) {
        Scanner in= new Scanner(System.in);
        int a=in.nextInt();
        for (int i = 1; i <=a ; i++) {
            for (int j = 1; j <=i ; j++) {
                System.out.println(j+"*"+i+"="+j*i+" ");
            }
            System.out.println();
        }

    }
}
